
# Install packages --------------------------------------------------------

packages <- c("tidyverse","effectsize","scales","plm","ggpubr","stargazer","interflex","rstan","ggrepel",
              "hablar","showtext","sysfonts")

for (package in packages) {
  if (!requireNamespace(package, quietly = TRUE)) {
    install.packages(package, dependencies = TRUE)
  }
}

# Load packages -----------------------------------------------------------

library(tidyverse)
library(effectsize)
library(scales)
library(plm)
library(ggpubr)
library(stargazer)
library(interflex)
library(rstan)
library(ggrepel)
library(hablar)
library(showtext)
library(sysfonts)

# Set the theme -----------------------------------------------------------

font_file <- "lmroman10-regular-webfont.ttf"
font_add("lmodern", regular = font_file)
showtext_auto()

theme_set(
  theme_light() +
    theme(
      text = element_text(family = "lmodern", size = 14), # Increase font size
      plot.title = element_text(family = "lmodern", face = "bold", size = 14), # Increase font size
      axis.title = element_text(family = "lmodern", face = "bold", size = 14), # Increase font size
      axis.text = element_text(family = "lmodern", size = 10), # Increase font size
      legend.title = element_blank(),
      legend.text = element_text(family = "lmodern", size = 10), # Increase font size
      legend.position = "top",
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      plot.background = element_rect(fill = "white")
    )
)
